# Contributor: Alex McGrath <amk@amk.ie>
# Maintainer: Alex McGrath <amk@amk.ie>
pkgname=gonic
pkgver=0.14.0
pkgrel=4
pkgdesc="Subsonic compatible music streaming server"
url="https://github.com/sentriz/gonic"
arch="all"
license="GPL-3.0-or-later"
subpackages="$pkgname-openrc"
depends="ffmpeg sqlite"
makedepends="go alsa-lib-dev taglib-dev zlib-dev"
install="$pkgname.pre-install"
source="gonic-$pkgver.tar.gz::https://github.com/sentriz/gonic/archive/v$pkgver.tar.gz
	gonic.initd
	gonic.confd
	"
export GOPATH="$srcdir"
export GO111MODULES=on

build() {
	go build -o gonic ./cmd/gonic/gonic.go
}

check() {
	go test ./...
}

package() {
	install -m755 -D "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname
	install -m644 -D "$srcdir"/$pkgname.confd \
		"$pkgdir"/etc/conf.d/$pkgname
	install -Dm755 "$builddir"/"$pkgname" \
		"$pkgdir"/usr/bin/"$pkgname"

}

cleanup_srcdir() {
	go clean -modcache
	default_cleanup_srcdir
}


sha512sums="
b518b42e102d834ba04d82f5e4a64f38cb6a1d6b34a025f3f76c4a571ff377c1566c6126c8de9e69440c5420a2091070713f9a6e5b4ad5ae51bb8170cacd2ba9  gonic-0.14.0.tar.gz
e8a65612bffd1b62175968cc34a227393364ea6fedd661854bf515cc7306e9266d823544989b671f99beb72b6caf83728fa7c7fd9eedbc85a3e34ea84c1ce269  gonic.initd
bce2f839f98e2b66010f14e52265a061644867109e43062672bdf3850de51ab8d7b61ea38d7f223de25cf91105ef441b0c1969afc812763702397ed60c0fba4f  gonic.confd
"
